//
//  DECXChargeTableCell.m
//  DECXInStore
//
//  Created by 李坤 on 2019/12/17.
//  Copyright © 2019 程强. All rights reserved.
//

#import "DECXChargeTableCell.h"

@implementation DECXChargeTableCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI
{
    self.contentView.backgroundColor = RGBColor(245, 244, 250);
    UIView *topView = [UIView new];
    topView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.top.width.equalTo(self.contentView);
        make.height.equalTo(@60);
    }];
    _dateLbl = [UILabel new];
    _dateLbl.font = [UIFont boldSystemFontOfSize:15.0];
    _dateLbl.textAlignment = NSTextAlignmentLeft;
    _dateLbl.text = @"2019年12月17日";
    [topView addSubview:_dateLbl];
    [_dateLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(topView);
        make.left.equalTo(topView).offset(15);
        make.height.equalTo(@30);
        make.width.equalTo(@150);
    }];
    _sumLbl = [UILabel new];
    _sumLbl.font = [UIFont boldSystemFontOfSize:15.0];
    _sumLbl.textAlignment = NSTextAlignmentRight;
    _sumLbl.text = @"900.0";
    [topView addSubview:_sumLbl];
    [_sumLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(topView);
        make.right.equalTo(topView).offset(-15);
        make.height.equalTo(@30);
        make.width.equalTo(@150);
    }];
    
    UIView *bottomView = [UIView new];
    bottomView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom).offset(1);
        make.centerX.width.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView).offset(-10);
    }];
    UILabel *p_title = [UILabel new];
    p_title.text = @"单价";
    p_title.textColor = [UIColor lightGrayColor];
    p_title.font = [UIFont systemFontOfSize:13.0];
    [bottomView addSubview:p_title];
    [p_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bottomView).offset(15);
        make.top.equalTo(bottomView).offset(5);
        make.width.equalTo(@60);
        make.height.equalTo(@20);
    }];
    _priceLbl = [UILabel new];
    _priceLbl.text = @"864";
    _priceLbl.textColor = [UIColor lightGrayColor];
    _priceLbl.font = [UIFont systemFontOfSize:13.0];
    _priceLbl.textAlignment = NSTextAlignmentRight;
    [bottomView addSubview:_priceLbl];
    [_priceLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(p_title);
        make.right.equalTo(bottomView).offset(-15);
        make.width.equalTo(@100);
        make.height.equalTo(@20);
    }];
    UILabel *w_title = [UILabel new];
    w_title.text = @"重量";
    w_title.textColor = [UIColor lightGrayColor];
    w_title.font = [UIFont systemFontOfSize:13.0];
    [bottomView addSubview:w_title];
    [w_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bottomView).offset(15);
        make.top.equalTo(p_title.mas_bottom).offset(5);
        make.width.equalTo(@60);
        make.height.equalTo(@20);
    }];
    _countLbl = [UILabel new];
    _countLbl.text = @"10.0吨";
    _countLbl.textColor = [UIColor lightGrayColor];
    _countLbl.font = [UIFont systemFontOfSize:13.0];
    _countLbl.textAlignment = NSTextAlignmentRight;
    [bottomView addSubview:_countLbl];
    [_countLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(w_title);
        make.right.equalTo(bottomView).offset(-15);
        make.width.equalTo(@100);
        make.height.equalTo(@20);
    }];
    UILabel *m_title = [UILabel new];
    m_title.text = @"备注";
    m_title.textColor = [UIColor lightGrayColor];
    m_title.font = [UIFont systemFontOfSize:13.0];
    [bottomView addSubview:m_title];
    [m_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bottomView).offset(15);
        make.top.equalTo(w_title.mas_bottom).offset(5);
        make.width.equalTo(@60);
        make.height.equalTo(@20);
    }];
    _markLbl = [UILabel new];
    _markLbl.text = @"已结算10吨";
    _markLbl.textColor = [UIColor lightGrayColor];
    _markLbl.font = [UIFont systemFontOfSize:13.0];
    _markLbl.textAlignment = NSTextAlignmentRight;
    [bottomView addSubview:_markLbl];
    [_markLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(m_title);
        make.right.equalTo(bottomView).offset(-15);
        make.width.equalTo(@100);
        make.height.equalTo(@20);
    }];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
